#include "EventManager.h"

EventManager::EventManager(void){}

EventManager::~EventManager(void){}

void EventManager::ResetInput()
{
	_RightInput
		=_DownInput
		= _LeftInput
		= _UpInput
		= false;
}

void EventManager::UpdateInput(sf::RenderWindow &pRenderWindow)
{
	//Reset input sates
	ResetInput();

	// Process events
	sf::Event Event;
	while (pRenderWindow.GetEvent(Event))
	{
		// Close window : exit
		if (Event.Type == sf::Event::Closed) pRenderWindow.Close();

		//Key
		else if(Event.Type == sf::Event::KeyPressed)
		{
			switch(Event.Key.Code)
			{
				case sf::Key::Right:
					_RightInput = true;
					break;
				case sf::Key::Down:
					_DownInput = true;
					break;
				case sf::Key::Left:
					_LeftInput = true;
					break;
				case sf::Key::Up:
					_UpInput = true;
					break;
			}
		}
	}
}
